package cn.com.anysdk.starter.config.redis;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 本地Redis配置属性
 * 用于Spring Boot环境下的本地Redis配置绑定
 */
@ConfigurationProperties(prefix = "anysdk.redis.local")
public class LocalRedisProperties {
    
    /** 是否启用本地Redis */
    private boolean enabled = true;
    
    /** Redis服务器地址 */
    private String host = "localhost";
    
    /** Redis服务器端口 */
    private int port = 6379;
    
    /** Redis密码 */
    private String password;
    
    /** Redis数据库索引 */
    private int database = 0;
    
    /** 连接超时时间（毫秒） */
    private int connectionTimeout = 10000;
    
    /** 读取超时时间（毫秒） */
    private int soTimeout = 10000;
    
    /** 连接池最大连接数 */
    private int maxTotal = 8;
    
    /** 连接池最大空闲连接数 */
    private int maxIdle = 8;
    
    /** 连接池最小空闲连接数 */
    private int minIdle = 0;
    
    /** 获取连接时的最大等待毫秒数 */
    private long maxWaitMillis = -1L;
    
    /** 借用连接时是否测试 */
    private boolean testOnBorrow = true;
    
    /** 归还连接时是否测试 */
    private boolean testOnReturn = false;
    
    /** 空闲时是否测试连接 */
    private boolean testWhileIdle = true;
    
    // Getter and Setter methods
    
    public boolean isEnabled() {
        return enabled;
    }
    
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
    
    public String getHost() {
        return host;
    }
    
    public void setHost(String host) {
        this.host = host;
    }
    
    public int getPort() {
        return port;
    }
    
    public void setPort(int port) {
        this.port = port;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public int getDatabase() {
        return database;
    }
    
    public void setDatabase(int database) {
        this.database = database;
    }
    
    public int getConnectionTimeout() {
        return connectionTimeout;
    }
    
    public void setConnectionTimeout(int connectionTimeout) {
        this.connectionTimeout = connectionTimeout;
    }
    
    public int getSoTimeout() {
        return soTimeout;
    }
    
    public void setSoTimeout(int soTimeout) {
        this.soTimeout = soTimeout;
    }
    
    public int getMaxTotal() {
        return maxTotal;
    }
    
    public void setMaxTotal(int maxTotal) {
        this.maxTotal = maxTotal;
    }
    
    public int getMaxIdle() {
        return maxIdle;
    }
    
    public void setMaxIdle(int maxIdle) {
        this.maxIdle = maxIdle;
    }
    
    public int getMinIdle() {
        return minIdle;
    }
    
    public void setMinIdle(int minIdle) {
        this.minIdle = minIdle;
    }
    
    public long getMaxWaitMillis() {
        return maxWaitMillis;
    }
    
    public void setMaxWaitMillis(long maxWaitMillis) {
        this.maxWaitMillis = maxWaitMillis;
    }
    
    public boolean isTestOnBorrow() {
        return testOnBorrow;
    }
    
    public void setTestOnBorrow(boolean testOnBorrow) {
        this.testOnBorrow = testOnBorrow;
    }
    
    public boolean isTestOnReturn() {
        return testOnReturn;
    }
    
    public void setTestOnReturn(boolean testOnReturn) {
        this.testOnReturn = testOnReturn;
    }
    
    public boolean isTestWhileIdle() {
        return testWhileIdle;
    }
    
    public void setTestWhileIdle(boolean testWhileIdle) {
        this.testWhileIdle = testWhileIdle;
    }
}